package proxy.dynamic.jdk.handler;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @InvokeSendHandler:
 * @author: ZBoHang
 * @time: 2021/9/30 16:45
 */
public class InvokeSendHandler implements InvocationHandler {

    private final Object target;

    public InvokeSendHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("before");
        Object invoke = method.invoke(target, args);
        System.out.println("after");
        return invoke;
    }
}
